import IAsset from "../Interfaces/IAsset";
import EntityTypes from "../Constants/EntityTypes";
import Oriented from "../Constants/Oriented";
import C from "../Configs/Config";
import MonsterBehaviour from "../Constants/MonsterBehaviour";

/**
 * 怪物表结构
 * creted by Five on 2018-11-19 17:12:34
 */

export default class MonsterAssetStruct implements IAsset {
    readonly asset: string;
    readonly id: number;
    readonly name: string;
    readonly last: number;
    // 击杀掉落
    readonly dropdown: number;
    // 速度
    readonly speed: number;
    // 初始朝向
    oriented: Oriented;
    // 物件的属性
    readonly type: EntityTypes;
    // 怪物的特性
    readonly behavior: MonsterBehaviour;
    // 特性的时间间隔
    readonly bespan: number;

    constructor(mas: MonsterAssetStruct) {
        let assetC = C().Monster.GetConfig(mas.id);
        this.id = mas.id;
        this.name = mas.name;
        this.asset = mas.asset;
        this.type = assetC.type;
        this.last = assetC.last;
        this.dropdown = assetC.dropdown;
        this.oriented = mas.oriented ? mas.oriented : Oriented.LEFT;
        this.speed = assetC.speed;
        this.behavior = assetC.behavior;
        this.bespan = assetC.bespan;
    }
}